<?php

/*
 * This file is part of the overtrue/laravel-wechat.
 *
 * (c) overtrue <i@overtrue.me>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

return [
    /*
     * 默认配置，将会合并到各模块中
     */
    'defaults'         => [
        /*
         * 指定 API 调用返回结果的类型：array(default)/collection/object/raw/自定义类名
         */
        'response_type'     => 'array',

        /*
         * 使用 Laravel 的缓存系统
         */
        'use_laravel_cache' => true,

        /*
         * 日志配置
         *
         * level: 日志级别，可选为：
         *                 debug/info/notice/warning/error/critical/alert/emergency
         * file：日志文件位置(绝对路径!!!)，要求可写权限
         */
        'log'               => [
            'level' => env('WECHAT_LOG_LEVEL', 'debug'),
            'file'  => env('WECHAT_LOG_FILE', storage_path('logs/wechat.log')),
        ],
    ],

    /*
     * 路由配置
     */
    'route'            => [
        /*
         * 开放平台第三方平台路由配置
         */
        // 'open_platform' => [
        //     'uri' => 'serve'
        //     'action' => Overtrue\LaravelWeChat\Controllers\OpenPlatformController::class,
        //     'attributes' => [
        //         'prefix' => 'open-platform',
        //         'middleware' => null,
        //     ],
        // ],
    ],

    /*
     * 公众号
     */
    'official_account' => [
        'default' => [
            'app_id'  => env('WECHAT_OFFICIAL_ACCOUNT_APPID', 'your-app-id'),         // AppID
            'secret'  => env('WECHAT_OFFICIAL_ACCOUNT_SECRET', 'your-app-secret'),    // AppSecret
            'token'   => env('WECHAT_OFFICIAL_ACCOUNT_TOKEN', 'eda027a1fc8eb364d7a76e4b8cd98d2f'),           // Token
            'aes_key' => env('WECHAT_OFFICIAL_ACCOUNT_AES_KEY', 'pyoBHZaI4PMqFBMc0p8DTmfdVwIY7eFE5Zs43cghEeG'),                 // EncodingAESKey

            /*
             * OAuth 配置
             *
             * scopes：公众平台（snsapi_userinfo / snsapi_base），开放平台：snsapi_login
             * callback：OAuth授权完成后的回调页地址(如果使用中间件，则随便填写。。。)
             * enforce_https：是否强制使用 HTTPS 跳转
             */
            'oauth'   => [
                'scopes'        => array_map(
                    'trim',
                    explode(',', env('WECHAT_OFFICIAL_ACCOUNT_OAUTH_SCOPES', 'snsapi_userinfo'))
                ),
                'callback'      => env('WECHAT_OFFICIAL_ACCOUNT_OAUTH_CALLBACK', '/examples/oauth_callback.php'),
                'enforce_https' => true,
            ],
        ],
    ],
    'official_payment' => [
        'default' => [
            'sandbox'    => env('WECHAT_PAYMENT_SANDBOX', false),
            'app_id'     => env('WECHAT_OFFICIAL_ACCOUNT_APPID', 'your-app-id'),         // AppID
            'mch_id'     => env('WECHAT_OFFICIAL_MCH_ID', 'your-mch-id'),
            'cert'       => env('WECHAT_PAYMENT_KEY', '85f365e266782b5b450885feb60a3015'),
            'key'        => env('WECHAT_PAYMENT_KEY', 'key-for-signature'),
            'cert_path'  => env('WECHAT_PAYMENT_CERT_PATH', 'path/to/cert/apiclient_cert.pem'),    // XXX: 绝对路径！！！！
            'key_path'   => env('WECHAT_PAYMENT_KEY_PATH', 'path/to/cert/apiclient_key.pem'),      // XXX: 绝对路径！！！！
            'notify_url' => 'http://example.com/payments/wechat-notify',                           // 默认支付结果通知地址
        ],
    ],

    /*
     * 开放平台第三方平台
     */
    // 'open_platform' => [
    //     'default' => [
    //         'app_id'  => env('WECHAT_OPEN_PLATFORM_APPID', ''),
    //         'secret'  => env('WECHAT_OPEN_PLATFORM_SECRET', ''),
    //         'token'   => env('WECHAT_OPEN_PLATFORM_TOKEN', ''),
    //         'aes_key' => env('WECHAT_OPEN_PLATFORM_AES_KEY', ''),
    //     ],
    // ],

    /*
     * 小程序
     */
    'mini_program'     => [
        'default' => [
            'app_id'  => env('WECHAT_MINI_PROGRAM_APPID', 'wx644c51031c07fd60'),
            'secret'  => env('WECHAT_MINI_PROGRAM_SECRET', '0d1355ecbcf641555b53a90592e3f2c7'),
            'token'   => env('WECHAT_MINI_PROGRAM_TOKEN', ''),
            'aes_key' => env('WECHAT_MINI_PROGRAM_AES_KEY', ''),
        ],
    ],

    /*
     * 微信支付
     */
    'payment'          => [
        'default' => [
            'sandbox'    => env('WECHAT_PAYMENT_SANDBOX', false),
            'app_id'     => env('WECHAT_PAYMENT_APPID', ''),
            'mch_id'     => env('WECHAT_PAYMENT_MCH_ID', 'your-mch-id'),
            'cert'       => env('WECHAT_PAYMENT_KEY', '85f365e266782b5b450885feb60a3015'),
            'key'        => env('WECHAT_PAYMENT_KEY', 'key-for-signature'),
            'cert_path'  => env('WECHAT_PAYMENT_CERT_PATH', 'path/to/cert/apiclient_cert.pem'),    // XXX: 绝对路径！！！！
            'key_path'   => env('WECHAT_PAYMENT_KEY_PATH', 'path/to/cert/apiclient_key.pem'),      // XXX: 绝对路径！！！！
            'notify_url' => 'http://example.com/payments/wechat-notify',                           // 默认支付结果通知地址
        ],
    ],

    /*
     * 企业微信
     */
     'work' => [
         'default' => [
             'corp_id' => 'wwe0061742cb82908f',
             'agent_id' => 1000005,
                 # 7p70YkTV1TwpquM7ydjoEZzV7oOuMHED6-NfkzndHMI

             'secret'   => env('WECHAT_WORK_AGENT_CONTACTS_SECRET', '7p70YkTV1TwpquM7ydjoEZzV7oOuMHED6-NfkzndHMI'),
             'response_type' => 'array',
             'log' => [
//                 'level' => 'debug',
//                 'file' => __DIR__.'/wechat.log',
                 'level' => env('WECHAT_LOG_LEVEL', 'debug'),
                 'file'  => env('WECHAT_LOG_FILE', storage_path('logs/wechat.log')),
             ],
              //...
             // server config
             'suite_id'             => 'wwe0061742cb82908f',
             'suite_secret'         => '应用secret',
             'token' => '0pBvVwtPjp8578',
             'aes_key' => 'MgmEL6sjV1izfveadsHhoDmrVyOj5mNSR3GELuRsNJn',
             'redirect_uri_install' => 'https://api.kjhhello.cn/api/test/workNotity/',
             'redirect_uri_single'  => 'https://api.kjhhello.cn/api/test/workNotity/',
             'redirect_uri_oauth'   => 'https://api.kjhhello.cn/api/test/workNotity/'
          ],
     ],
    /*
     * 企业微信服务商
     */
    'wework' => [
        'ww5b82f853255d7c97' => [
            'corp_id' => 'wwe0061742cb82908f',
            'secret' => 'rj9I5NX4jDYcg_UySfSqUmGyj1PionNVA1kuExwW0_PffD7XayHdXFudYyPgUMkN',
            'suite_id' => 'ww5b82f853255d7c97',
            'suite_secret' => 'WCk3BEQHaVK7D1ikNSEiYNa-VHBHWfqckRTpSrPRWyw',
            'token' => 'TEYBVG22EPIDToExUTAj',
            'aes_key' => 'GarWE5l43uuCnLo9GSyIGxWeOHBr2ZQf2Myab7tSjO1',
            'agent_id' => 1000014,
//            'reg_template_id'      => '注册定制化模板ID',
//            'redirect_uri_install' => '安装应用的回调url（可选）',
//            'redirect_uri_single'  => '单点登录回调url （可选）',
//            'redirect_uri_oauth'   => '网页授权第三方回调url （可选）',
        ],
        'wwd484c9224a67eb2a' => [
            'corp_id' => 'wwe0061742cb82908f',
            'secret' => 'rj9I5NX4jDYcg_UySfSqUmGyj1PionNVA1kuExwW0_PffD7XayHdXFudYyPgUMkN',
            'suite_id' => 'wwd484c9224a67eb2a',
            'suite_secret' => 'Jj523Jh3sJDhLC9_I3v11NsiTji9DnEF4bkO9YznZ40',
            'token' => 'TEYBVG22EPIDToExUTAj',
            'aes_key' => 'GarWE5l43uuCnLo9GSyIGxWeOHBr2ZQf2Myab7tSjO1',
            'agent_id' => 1000014,
//            'reg_template_id'      => '注册定制化模板ID',
//            'redirect_uri_install' => '安装应用的回调url（可选）',
//            'redirect_uri_single'  => '单点登录回调url （可选）',
//            'redirect_uri_oauth'   => '网页授权第三方回调url （可选）',
        ],

    ],
];
